﻿<%@ Page Language="C#" AutoEventWireup="true" MasterPageFile="~/BodyMasterPage.Master"
   CodeBehind="wfProcPlaCalcBnd.aspx.cs" Inherits="RH.wfProcPlaCalcBnd" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajax" %>
<%@ Import Namespace="Texfina.Core.Common" %>
<%@ Import Namespace="Texfina.Common.Mg" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">
   <script type="text/javascript">
       $(document).ready(function () {
           Sys.WebForms.PageRequestManager.getInstance().add_pageLoaded(PageLoaded)
       });

       function PageLoaded(sender, args) {
           ResizeGrid();
           MessageOnPostback();
       }

      function ResizeGrid() {
         internalGridResize("<%= grdList.ClientID %>");
      }

      function validateGridCommands(key, rowIndex) {
          var row = getGridRowByIndex('<%= grdList.ClientID %>', rowIndex);
          if (getObjInnerText(row.cells[parseInt('<%=_GRDLIST_STANULADO %>')]) == '<%=ConstFlagEstado.ACTIVADO %>') {
             AtentionAlert('El Registro se encuentra eliminado, no puede realizar ninguna accion.');
              return false;
          }

          if (getObjInnerText(row.cells[parseInt('<%=_GRDLIST_STPROCESO %>')]) == '<%=ConstEstadoProcePlani.CERRADA %>') {
             AtentionAlert('El Proceso se encuentra cerrado, no puede realizar ninguna accion.');
              return false;
          }

          return true;
      }

      function demotokenfunction() {
          var vartoken = $("#textFilter").tokenInput("get");
          document.getElementById("<%=hdnFilter.ClientID%>").value = JSON.stringify(vartoken);
      }
   </script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
   <asp:UpdatePanel ID="UpdatePanel1" runat="server">
      <ContentTemplate>
         <div class="DataHeader">
            <table id="TableDataHeader" cellpadding="0" cellspacing="0">
                    <tr>
                        <td colspan="3">
                            &nbsp;
                        </td>
                    </tr>
                    <tr>
                        <td style="width: 5px;">
                            &nbsp;
                        </td>
                        <td>
                            <table width="100%" cellpadding="0" cellspacing="2">
                                <tr>
                                    <td rowspan="3">
                                        <esd:esdFilterText ID="textFilter" runat="server" />
                                    </td>
                                    <td style="width: 90px;">
                                        <esd:esdButton ID="bttClear" runat="server" Text="Limpiar" Width="80px"></esd:esdButton>
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                        &nbsp;
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                        <esd:esdButton ID="bttSearch" runat="server" Text="Buscar" Width="80px" OnClick="bttOk_Click">
                                        </esd:esdButton>
                                    </td>
                                </tr>
                            </table>
                        </td>
                        <td style="width: 5px;">
                            &nbsp;
                        </td>
                    </tr>
                    <tr>
                        <td colspan="3">
                            &nbsp;
                        </td>
                    </tr>
                </table>
         </div>
         <div class="DataDetail">
            <esd:esdGridView CssClass="esdGridView" ID="grdList" runat="server" ScrollWidth="100%"
               Width="100%" ShowHeaderWhenEmpty="True" AutoGenerateColumns="False" DataKeyNames="RowNumber"
               OnRowCommand="grdList_RowCommand" OnRowDataBound="grdList_RowDataBound">
               <Columns>
                  <asp:TemplateField>
                     <ItemTemplate>
                        <asp:ImageButton ID="grdBttCmdEdit" CommandName="CmdEdit" CommandArgument="<%# Container.DataItemIndex %>"
                           runat="server" ImageUrl="../Images/Icons/Enabled/DbStart.png" ToolTip="Ejecutar calculo de planilla" />
                     </ItemTemplate>
                     <HeaderStyle Width="22px" />
                     <ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                  </asp:TemplateField>

                  <asp:TemplateField>
                            <HeaderTemplate>
                                <esd:esdFilterPanel ID="idMes" 
                                    Identity="a.idMes" 
                                    DataSourceComboText="dsDescrip"
                                    DataSourceComboValue="idCodigo"
                                    runat="server" 
                                    Title="Mes" 
                                    ControlToken="textFilter" 
                                    FilterType="esdDropDownList" />
                            </HeaderTemplate>
                            <ItemTemplate>
                                <%#Eval("dsMes")%>
                            </ItemTemplate>
                  </asp:TemplateField>

                  <asp:TemplateField>
                            <HeaderTemplate>
                                <esd:esdFilterPanel ID="idForPago" 
                                    Identity="a.idForPago" 
                                    DataSourceComboText="dsDescrip"
                                    DataSourceComboValue="idCodigo"
                                    runat="server" 
                                    Title="Form.Pago" 
                                    ControlToken="textFilter" 
                                    FilterType="esdDropDownList" />
                            </HeaderTemplate>
                            <ItemTemplate>
                                <%#Eval("dsForPago")%>
                            </ItemTemplate>
                  </asp:TemplateField>

                   <asp:TemplateField>
                            <HeaderTemplate>
                                <esd:esdFilterPanel ID="dsPlanilla" 
                                    Identity="b.dsPlanilla" 
                                    runat="server" 
                                    Title="Planilla" 
                                    ControlToken="textFilter" 
                                    FilterType="esdTextBox" />
                            </HeaderTemplate>
                            <ItemTemplate>
                                <%#Eval("dsPlanilla")%>
                            </ItemTemplate>
                  </asp:TemplateField>
                  
                  <asp:BoundField DataField="nuProcAnual" HeaderText="Proceso Anual"></asp:BoundField>
                  <asp:BoundField DataField="feDesde" HeaderText="Fecha Desde" DataFormatString="{0:dd/MM/yyyy}">
                  </asp:BoundField>
                  <asp:BoundField DataField="feHasta" HeaderText="Fecha Hasta" DataFormatString="{0:dd/MM/yyyy}">
                  </asp:BoundField>
                  <asp:BoundField DataField="feProceso" HeaderText="Fecha Proceso" DataFormatString="{0:dd/MM/yyyy}">
                  </asp:BoundField>
                  <asp:BoundField DataField="dsStProceso" HeaderText="Estado Proceso"></asp:BoundField>
                  <asp:BoundField DataField="stProceso" HeaderStyle-CssClass="hideDataGridColumn" ItemStyle-CssClass="hideDataGridColumn">
                  </asp:BoundField>
                  <asp:BoundField DataField="stAnulado" HeaderStyle-CssClass="hideDataGridColumn" ItemStyle-CssClass="hideDataGridColumn">
                  </asp:BoundField>
               </Columns>
               <EmptyDataTemplate>
                  <div id="gridempty">
                     <asp:Image ID="imgEmpty" runat="server" ImageUrl="../Images/Controls/Attention.png" />
                     &nbsp;No existen registros para esta solicitud.
                  </div>
               </EmptyDataTemplate>
            </esd:esdGridView>
         </div>
         <asp:HiddenField ID="hdnFilter" runat="server" />
         <asp:HiddenField ID="hdnMsgOPB" runat="server" />
         <asp:HiddenField ID="hdnmodalPopup" runat="server" />
         <asp:HiddenField ID="hdnidPeriodo" runat="server" />
         <asp:HiddenField ID="hdnidEmpresa" runat="server" />
         <asp:HiddenField ID="hdnidForPago" runat="server" />
         <asp:HiddenField ID="hdnidPlanilla" runat="server" />
         <asp:HiddenField ID="hdnnuProcAnual" runat="server" />
         <asp:HiddenField ID="hdnidMes" runat="server" />
         <asp:HiddenField ID="hdnidPersonal" runat="server" />
         
         <asp:Panel runat="server" ID="PnlPopup" CssClass="modalPopup" Width="450px">
        <table width="100%" cellpadding="0" cellspacing="2">
            <tr>
                <td colspan="3">
                    <div class="modalPopupHeader">
                        &nbsp;&nbsp;&nbsp;<asp:Label ID="lblTitlePopup" runat="server"></asp:Label>
                    </div>
                </td>
            </tr>
            <tr>
                <td colspan="3">
                    &nbsp;
                </td>
            </tr>
            <tr>
                <td style="width: 5px;">
                    &nbsp;
                </td>
                <td>
                    <table width="100%" cellpadding="1" cellspacing="2">
                         <tr>
                            <td style="width: 5px">
                                &nbsp;
                            </td>
                            <td colspan="11">
                                Ejecutar Para:
                            </td>
                            <td style="width: 5px">
                                &nbsp;
                            </td>
                        </tr>

                        <tr>
                            <td style="width: 5px">
                                &nbsp;
                            </td>
                            <td colspan="11">
                                <asp:RadioButton ID="rbExeTodos" Checked="true" GroupName="RbGroupAll" runat="server" Text="Todo el Personal de la Planilla" />
                            </td>
                            <td style="width: 5px">
                                &nbsp;
                            </td>
                        </tr>
                        <tr>
                            <td style="width: 5px">
                                &nbsp;
                            </td>
                            <td>
                                <asp:RadioButton ID="rbExeOne" GroupName="RbGroupAll" runat="server" Text="Solo Para :" />
                            </td>
                            <td colspan="10">
                                <esd:esdButtonTextBox runat="server" ID="txtidPersonal" Width="250px">   
                                </esd:esdButtonTextBox>
                            </td>
                            <td style="width: 5px">
                                &nbsp;
                            </td>
                        </tr>
                    </table>
                </td>
                <td style="width: 5px;">
                    &nbsp;
                </td>
            </tr>
            <tr>
                <td colspan="3">
                    &nbsp;
                </td>
            </tr>
            <tr>
                <td style="width: 5px;">
                    &nbsp;
                </td>
                <td align="right">
                    <esd:esdButton ID="bttOkPopup" runat="server" Text="Aceptar" Width="80px" OnClick="bttOkPopup_Click">
                    </esd:esdButton>
                    <esd:esdButton ID="bttCancelPopup" runat="server" Text="Cancelar" Width="80px"></esd:esdButton>
                </td>
                <td style="width: 5px;">
                    &nbsp;
                </td>
            </tr>
            <tr>
                <td colspan="3">
                    &nbsp;
                </td>
            </tr>
        </table>
    </asp:Panel>
    <ajax:ModalPopupExtender runat="server" ID="mdlPopup" PopupControlID="PnlPopup" BackgroundCssClass="modalBackground"
        TargetControlID="hdnmodalPopup">
    </ajax:ModalPopupExtender>
      </ContentTemplate>
   </asp:UpdatePanel>
   <ajax:UpdatePanelAnimationExtender ID="upae" BehaviorID="animation" runat="server"
      TargetControlID="updatePanel1">
      <animations>
        <OnUpdating>
        <Parallel duration="0.5">
            <ScriptAction Script="panelOnUpdating();" />  
        </Parallel>
        </OnUpdating>
        <OnUpdated>
        <Parallel duration="0.5">
            <ScriptAction Script="panelOnUpdated();" /> 
        </Parallel> 
        </OnUpdated>
    </animations>
   </ajax:UpdatePanelAnimationExtender>
   <div id="updateProgressDiv" class="updateProgress" style="display: none">
      <table width="100%">
         <tr>
            <td valign="middle">
               <img src="../Images/Controls/Loading.gif" />
            </td>
            <td valign="middle">
               <span class="updateProgressMessage">Cargando ...</span>
            </td>
         </tr>
      </table>
   </div>
</asp:Content>
